1. Field of the Invention
The present invention relates to an electronic apparatus, and, more particularly, to an electronic apparatus, such as an image forming apparatus, which operates in accordance with a control program stored in a memory, and has a function to download a program from a detachable memory medium such as an IC card.
2. Description of the Related Art
The operation of a conventional image forming apparatus, such as a digital copying machine or laser printer, is controlled by programs. Such an image forming apparatus is provided with a ROM storing the programs, and the operation of each component is controlled by carrying out each corresponding program.
However, if a change is to be made to the control programs due to known trouble such as bugs, the ROM that stores the programs has to be replaced. To replace the ROM, the apparatus itself has to be disassembled to the point where the ROM can be taken out of the apparatus. Especially after the completion of the apparatus, the replacing the ROM is too troublesome and time-consuming.
In order to shorten the time required for ROM replacing, a flash ROM provided with a program is employed. When a change has to be made to the program, a new program is supplied from an external apparatus, such as a host computer, and is written in the flash ROM. Japanese Laid-Open Patent Application No. 8-77040 discloses a rewrite control method for flash memory. According to this method, when the program data in the flash ROM is rewritten by computer communication, the condition of the image forming apparatus is checked. If the image forming apparatus is in a suitable condition for download, the download is carried out, and the image forming apparatus is prevented from overrunning.
In another recent method, an external memory device, such as an IC card, is connected to the image forming apparatus, and a program is downloaded from the IC card into the flash ROM to update or rewrite the program. By this method, the program updating time can be dramatically shortened. In such a case, by connecting the IC card to the apparatus, the addresses of the flash ROM and the IC card are interchanged on memory maps. By doing so, the apparatus is started based on the program stored in the IC card, and the program is downloaded into the flash ROM.
To download the program, Japanese Laid-Open Patent Application No. 10-145571 discloses techniques of preventing wrong program writing and preventing data stored in a non-volatile memory from being destroyed when a program from the IC card is written in the flash ROM. The data stored in the non-volatile memory should be saved even after the power source of the apparatus is switched off, containing data on operation conditions of the apparatus. If the apparatus is a copying machine on lease, for instance, information concerning a lease charge, such as information on the number of copies made, is stored in the non-volatile memory.
The IC card in the image forming apparatus may be utilized for option programs, for instance, a program of adding a data table to the main program stored in the flash ROM. In such a case, functions other than the standard functions can be added by connecting the IC card to start the apparatus.
In the image forming apparatus having the above structure, even if the download of a desired program is already complete, the main device operates by the program stored in the IC card while the power switch is on.
Generally, a connector for the IC card is disposed in a place where the IC card can be easily inserted and pulled out. If the IC card is inadvertently or accidentally pulled out while the power switch is on, the program in operation in the main device might be stopped. In such a case, the main device is malfunctioned, or some components of the main device might be damaged due to the malfunction.
Furthermore, since the IC card is mainly used for download, the addresses of the flash ROM and the IC card are interchanged on memory maps by connecting the IC card to the main device, and the main device is then started by the program from the IC card. In a case where the IC card is used for option programs, the main device is started by the program from the IC card after the connection of the IC card is detected. In such a case, the main device cannot operate in accordance with the program stored in the flash ROM, because the program stored in the IC card is already selected. In other words, the IC card cannot be used for option programs. Therefore, when the IC card is used for option programs, a special operation needs to be performed so as to start the main device by the program from the flash ROM. Such a special operation only causes trouble for users.
In the image forming apparatus, user data, such as preset values of the apparatus and user information, is stored in the non-volatile memory. When the apparatus or the main control board is replaced with a new one, the non-volatile memory is mounted on the new one, carrying information from the replaced one. Thus, operations such as resetting can be made unnecessary. However, there is a problem that, when the main device is started by the program from the IC card to download the program, the user data stored in the non-volatile memory might be rewritten due to malfunction, such as program overrunning caused by imperfect connection of the IC card.
It is a general object of the present invention to provide an improved and useful electronic apparatus in which the above-mentioned problems are eliminated.
A more specific object of the present invention is to provide an electronic apparatus in which program reading can be easily switched between a memory medium such as a detachable IC card and a rewritable memory such as a flash ROM.
Another object of the present invention is to provide an electronic apparatus in which program overrun can be prevented even if the IC card slipped off the apparatus after download.
Still another object of the present invention is to provide an electronic apparatus in which the IC card can be used for downloading and option programs.
Yet another object of the present invention is to provide an electronic apparatus in which data stored in a non-volatile memory of the main device can be prevented from being rewritten or erased even if the IC card slips off the apparatus while a program is being downloaded from the IC card.
To achieve the above objects, the present invention provides an electronic apparatus including:
a memory which stores a first program;
a connector for connecting a memory medium which stores a second program;
a processor which controls an operation of the electronic apparatus by carrying out either the first program or the second program in accordance with memory maps having at least addresses of the memory and the memory medium logically arranged; and
an interchanging circuit which interchanges the addresses of the memory and the memory medium in accordance with the memory maps so that either the first program or the second program is selectively read out and is supplied to the processor.
With this structure, even if the IC card slips off the apparatus when a program is downloaded using the IC card, the main device can continue a normal operation by interchanging the addresses of the IC card and the processor on the memory maps after the download so as to switch the operation to a program operation of the memory of the main device.
The electronic apparatus of the present invention may further comprise: a detector which detects whether the memory medium is connected to the connector; and a switch for issuing an instruction to download the second program. If connection of the memory medium is detected and the switch is in a predetermined position when the power source of the electronic apparatus is turned on, the interchanging circuit interchanges the addresses of the memory and the memory medium in accordance with the memory maps.
With this structure, the program to be read at the time of power supply can be switched between the first program and the second program, so that the memory medium can be used for download or option programs, whichever the user wishes to use.
The electronic apparatus of the present invention may further comprise an error message output circuit which outputs an error message in a case where disconnection of the memory medium is detected and the switch is in the predetermined position when the power source of the electronic apparatus is turned on.
With this structure, in the case where power is supplied when the memory medium is unconnected and the switch is pushed, the user is notified of the malfunction and is advised to connect the memory medium properly.
The electronic apparatus of the present invention may further comprises: a non-volatile memory which stores data to be saved while the power source of the electronic apparatus is off; and a first access disable circuit which prohibits access to the non-volatile memory in a case where disconnection of the memory medium is detected and the switch is in the predetermined position when the power source of the electronic apparatus is turned on.
With this structure, if the download operation is performed when the IC card is unconnected, unprepared access to the non-volatile memory can be prevented, thereby protecting data stored in the non-volatile memory.
The electronic apparatus of the present invention further comprises a second access disable circuit which prohibits access to the non-volatile memory in a case where the detector detects disconnection of the memory medium after the second program is read from the memory medium.
With this structure, if the memory medium slips off the apparatus or has improper connection after the second program is booted from the memory medium, the second access disable circuit prohibits read and write access to the non-volatile memory. Thus, the data stored in the non-volatile memory can be prevented from being destroyed.
The electronic apparatus of the present invention may further comprises a write disable circuit which prohibits write in the non-volatile memory in a case where the detector detects disconnection of the memory medium after the second program is read from the memory medium.
With this structure, if the memory medium slips off the apparatus or has improper connection after the second program is booted from the memory medium, the write disable circuit prohibits write access to the non-volatile memory. Thus, the data stored in the non-volatile memory can be used for download, and can be prevented from being destroyed.
Other objects and further features of the present invention will become more apparent from the following description taken in conjunction with the accompanying drawings.